package java07;

class MonitorTask implements Runnable{
	private volatile boolean flag = false;  //用于停止线程的标志位
	private String word;
	public void stopMe(){
		this.flag=true;
		Thread.yield();
	}
	public void sendWord(String word){
		this.word=word;
	}
	public void run(){
		while(!flag){
			if(this.word!=null && this.word.contains("alien")){
				System.out.println(Thread.currentThread().getName()+" found alien in "+word);
				this.word=null;
				Thread.yield();
			}
		}
		System.out.println(Thread.currentThread().getName() + " stop");
	}
}
public class Main042 {
    public static void main(String[] args) throws InterruptedException {
        //裁判程序代码
    }
}
